In-flow
eLimu Games PostMessage
Overview
eLimu Games and the parent app communicate through the postMessage
API, exchanging data and triggering actions that facilitate seamless interaction. The data structure and actions are predefined, allowing the games to inform the parent app about various states and to request actions.
eLimu Games expect data from the parent app to initate the game state and persistent data. This communication is what we refer to as in-flow of data.
Valid actions expected are sign_in
and retrieve_user_data
.
Data Structure
The messages exchanged between the app and the games follow a consistent format:
let data = {
"action": string,
"payload": object,
}
Sample of sign_in
request data
const inflowData = {
"action": "sign_in",
"payload": {
"app_key": "game-name",
"user":{
"email": "your-email",
"firstName": "your-firstname",
"lastName": "your-lastname",
"username": "your-username"
}
}
}
Sample of retrieve_user_data
request data
const inflowData = {
"action": "retrieve_user_data",
"payload": {
"kpiKey1": 100,
"kpiKey2": 'string',
"kpiKey3": true,
}
}
Sample of data inflow request
const iframeDom = document.getElementById("partner-iframe-id");
window.iframeDom.postMessage(inflowData, "*");